{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加</h5>
                </div>
                <div class="ibox-content">

					<form id="formEdit" method="post" class="form-horizontal" action="{:url('ZhiyuanOrder/edit')}">

	
						<div class="form-group">
							<label class="col-sm-3 control-label"><span style="color:red;">*&nbsp;</span>手机号</label>
							<div class="input-group col-sm-4">
								<input type="text" id="mobile" name="mobile" placeholder="请输入" autocomplete="off" class="form-control">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label"><span style="color:red;">*&nbsp;</span>费用</label>
							<div class="input-group col-sm-4">
								<input type="text" id="order_money" name="order_money" placeholder="请输入" autocomplete="off" class="form-control"
									   value="{:isset($list.order_money)?$list.order_money:''}">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label"><span style="color:red;">*&nbsp;</span>选择专家</label>
							<div class="input-group col-sm-4">
								
                                <select class="form-control m-b chosen-select" name="zhuanjia_id" id="zhuanjia_id">
                                    <option value="">==请选择==</option>
                                    {if !empty($zhuanjia_list)}
                                        {foreach name="zhuanjia_list" item="vo"}
                                            <option value="{$vo.id}" {if condition="isset($list['zhuanjia_id']) and ($list['zhuanjia_id'] eq $vo['id'])"}selected{/if}>{$vo.real_name}</option>
                                        {/foreach}
                                    {/if}
                                </select>
							</div>
						</div>
						
						
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
								<input type="hidden" name="id" value="{:isset($list['id'])?$list['id']:''}">
                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                            </div>
                        </div>
					</form>

                </div>
            </div>

        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
    //提交
    $(function(){
        $('#formEdit').ajaxForm({
            beforeSubmit: checkForm, 
            success: complete, 
            dataType: 'json'
        });
        
		$("input[type=radio][name='valid_type']").change(function(){
            var valid_type = $(this).val();
			//alert(valid_type);
			if(valid_type == 2){
				$(".valid_days").hide();
			}else{
				$(".valid_days").show();
			}
        });
		
        function checkForm(){
            if( '' == $.trim($('#mobile').val())){
                layer.msg('请输入手机号',{icon:2,time:1500,shade: 0.1}, function(index){
                layer.close(index);
                });
                return false;
            }
            if( '' == $.trim($('#order_money').val())){
                layer.msg('请输入费用',{icon:2,time:1500,shade: 0.1}, function(index){
                layer.close(index);
                });
                return false;
            }
            if( '' == $.trim($('#zhuanjia_id').val())){
                layer.msg('请选择专家',{icon:2,time:1500,shade: 0.1}, function(index){
                layer.close(index);
                });
                return false;
            }
            
        }


        function complete(data){
            if(data.code==1){
                layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1}, function(index){
                    window.location.href="{:url('ZhiyuanOrder/index')}";
                });
            }else{
                layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1});
                return false;   
            }
        }
     
    });

</script>
</body>
</html>